@echo off
echo Word Compare Docker Service

REM 确保目录存在
if not exist uploads mkdir uploads
if not exist results mkdir results
if not exist logs mkdir logs

REM 检查.env文件是否存在，若不存在则创建
if not exist .env (
  echo Creating default .env file...
  (
    echo # 应用配置
    echo APP_PORT=5000
    echo APP_HOST=0.0.0.0
    echo APP_DEBUG=false
    echo.
    echo # 时区设置
    echo TZ=Asia/Shanghai
    echo.
    echo # 字符编码
    echo PYTHONIOENCODING=utf-8
    echo.
    echo # Docker 标记，用于应用内部检测是否在容器中运行
    echo DOCKER_CONTAINER=true
  ) > .env
)

REM 使用docker-compose启动服务
echo.
echo Starting Word Compare service...
docker-compose up -d --build

REM 显示访问URL
echo.
echo Service started! Access the application at:
echo http://localhost:5000
echo.
echo To view logs, run: docker-compose logs -f
echo To stop the service, run: docker-compose down
echo.
pause 